<div class="modal fade " id="addProductScoreModal"   role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">新增账户绩效评分</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal" id="addCustScoreForm">
                <div class="box-body">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">账户选择：</label>
                        <div class="col-sm-7">
                            <select id="addProductScoreId" class=" form-control select2" style="width: 100%">
                                <option value="-1">请选择账户</option>
                            <#if ProductInfoVos??>
                                <#list ProductInfoVos as vo  >
                                    <option value="${vo.productZtbh?if_exists}">${vo.productName?if_exists}</option>
                                </#list>
                            </#if>
                            </select>
                        </div>                       
                    </div>
                   
                   
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">绩效时间：</label>
                        <div class="col-sm-3">
                            <select id="addCustScoreFinancialYear" class="form-control" style="width: 100%" >
                                <option value="-1">请选择年份</option>
                            <#if years??>
                                <#list years as vo  >
                                    <option value="${vo?if_exists}">${vo?if_exists}</option>
                                </#list>
                            </#if>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <select id="addCustScoreFinancialReport" class="form-control" style="width: 100%" p>
                                 <option value="-1">请选择月份</option>
                             	<option value="01">1月份</option>
                                <option value="02">2月份</option>
                                <option value="03">3月份</option>
                                <option value="04">4月份</option>
                                <option value="05">5月份</option>
                                <option value="06">6月份</option>
                                <option value="07">7月份</option>
                                <option value="08">8月份</option>
                                <option value="09">9月份</option>
                                <option value="10">10月份</option>
                                <option value="11">11月份</option>
                                <option value="12">12月份</option>
                            </select>
                        </div>                        
                    </div>                   
                    
                       <div class="form-group">
                         <label for="inputEm3ail3" class="col-sm-2 control-label">评分模型：</label>
                        <div class="col-sm-7">
                           	<select id="versionId1" name="versionId1" class=" form-control select2" style="width: 100%">
                           	    						<option value="-1">请选择模型</option>
		                               				 	<#if scoreVersionVoList??>
		                                   				 <#list scoreVersionVoList as vo  >
		                                    			<option value="${vo.id?if_exists}">${vo.versionName?if_exists}</option>
		                                    		</#list>
		                               					 </#if>
                           							 </select>
                        </div>
                    </div>
                    
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"  >取消</button>

                    <button type="button" class="btn btn-primary pull-right" onclick="addProductScore()">保存</button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>
    function addCustScoreModalInit() {
        $("#addProductScoreId").val("-1").trigger("change");       
        $("#addCustScoreFinancialYear").val("-1").trigger("change");
        $("#addCustScoreFinancialReport").val("-1").trigger("change");
        $("#versionId1").val("-1").trigger("change");
        $("input[name='isPartake'][value='0']").attr("checked",'true');
    }
   

    function addProductScore() {
        var productZtbh = $("#addProductScoreId").val() ;
        if(productZtbh == "-1") {
            toastr['error']("请选择账户名称", '提示');
            return;
        }       
        var year =  $("#addCustScoreFinancialYear").val() ;
        if(year == "-1" ) {
            toastr['error']("请选择年份", '提示');
            return;
        }
        var month =  $("#addCustScoreFinancialReport").val() ;
        if(month == "-1" ) {
            toastr['error']("请选择月份", '提示');
            return;
        }
        var versionId =  $("#versionId1").val() ;
        if(versionId == "-1" ) {
            toastr['error']("请选择评分模型", '提示');
            return;
        }
        //alert(versionId);
        var data = {
            productZtbh: productZtbh ,
            periodTime: year + month,
            versionId: versionId
        };
        var url = "/newproduct/initproductscore";
        postReq(url, data, function (result) {
            if (result.success) {
                addCustScoreModalInit();
                $("#custScoreT111able").bootstrapTable("refresh");
                $("#addProductScoreModal").modal("hide");
                toastr['success']('新增产品评分成功', '提示');
            } else {
                toastr['error'](result.msg, '提示');
            }
        });
    }
</script>